{% extends "main/base.html" %}
{% load i18n static main_tag %}
{% block title %}{% trans '固定资产入库记录' %}{% endblock %}
{% block this_css %}
<link rel="stylesheet" type="text/css" href="{% static 'flatlab/css/bootstrap-select.min.css' %}">
{% endblock %}
{% block content %}
<section class="panel">
    <div class="panel-body">
        <div class="col-md-9">
            <form class="form-inline" role="form" method="get">
                <div class="form-group">{% if fixed_assets_types %}
                    <select name="c" class="selectpicker show-tick form-control" data-live-search="true">
                        <option value="">{% trans '所有类型' %}</option>
                        {% for ss in fixed_assets_types %}
                            {% if ss.pk|floatformat:'0' == request.GET.c|floatformat:'0' %}
                            <option value="{{ ss.pk }}" selected>{{ ss }}</option>
                            {% else %}
                            <option value="{{ ss.pk }}" >{{ ss }}</option>
                            {% endif %}
                        {% endfor %}
                    </select>{% endif %}
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <input class="form-control" type="text" name="q" placeholder="" value="{% if request.GET.q %}{{ request.GET.q }}{% endif %}">
                        <span class="input-group-btn"><button class="btn btn-primary" type="submit">搜索</button></span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>
<section class="panel">
    {% get_current_language as LANGUAGE_CODE %}
    <div class="table-responsive panel-body">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>{% trans 'No.' %}</th>
                    <th>{% trans '名称' %}</th>
                    <th>{% trans '规格' %}</th>{% if not request.GET.c %}
                    <th>{% trans '类别' %}</th>{% endif %}
                    <th>{% trans '入库日期' %}</th>
                    <th>{% trans '质保期限' %}</th>
                    <th>{% trans '单价' %}</th>
                    <th>{% trans '入库数' %}</th>
                    <th>{% trans '小计' %}</th>{% if perms.main.change_fixedassetsin %}
                    <th></th>{% endif %}
                </tr>
            </thead>
            <tbody>{% for d in page_obj %}
                <tr>
                    <td>{{ d.id }}</td>
                    <td>{{ d.fixed_assets.name_of_asset }}</td>
                    <td>{{ d.fixed_assets.specifications }}</td>{% if not request.GET.c %}
                    <td>{{ d.fixed_assets.fixed_assets_type }}</td>{% endif %}
                    <td>{{ d.date_of_purchase }}</td>
                    <td>{{ d.warranty_period }}</td>
                    <td>{{ d.price_each }} 元</td>
                    <td>{{ d.amount }}</td>
                    <td>{{ d.total_value|floatformat:2 }} 元</td>{% if perms.main.change_fixedassetsin %}
                    <td align="right">
                        <a href="{% url 'main:change_fixed_assets_in' d.pk %}"><button class="btn btn-success btn-xs"><i class="fa fa-pencil"></i></button></a>
                    </td>{% endif %}
                </tr>{% endfor %}
            </tbody>
        </table>
        <div align="right">
            {% include 'main/tablenav.html' %}
        </div>
    </div>
</section>
{% endblock %}
{% block this_js %}
<script type="text/javascript" src="{% static 'flatlab/js/bootstrap-select.min.js' %}"></script>
{% endblock %}